/**
 * Copyright (c) 2006, 2007, 2008 Marwan Abi-Antoun, Jonathan Aldrich, Nels E. Beckman,
 * Kevin Bierhoff, David Dickey, Ciera Jaspan, Thomas LaToza, Gabriel Zenarosa, and others.
 *
 * This file is part of Crystal.
 *
 * Crystal is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Crystal is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with Crystal.  If not, see <http://www.gnu.org/licenses/>.
 */
package edu.cmu.cs.crystal.tac.model;

/**
 * Binary operators including arithmetic, relational, and bitwise operators 
 * as well as bit shifts and string concatenation.  Notice that we distinguish
 * addition ({@link BinaryOperator#ARIT_ADD}) from string concatenation 
 * ({@link BinaryOperator#STRING_CONCAT}), even though both are written + (plus)
 * in the source.  Also notice that + (plus) and - (minus) can also be {@link BinaryOperator}s.
 * @author Kevin Bierhoff
 */
public enum BinaryOperator { 
	ARIT_ADD("+"), ARIT_MULTIPLY("*"), ARIT_SUBTRACT("-"), ARIT_DIVIDE("/"), ARIT_MODULO("%"),
	REL_EQ("=="), REL_NEQ("!="), REL_GT(">"), REL_GEQ(">="), REL_LT("<"), REL_LEQ("<="), 
	BITWISE_AND("&"), BITWISE_OR("|"), BITWISE_XOR("^"),
	SHIFT_LEFT("<<"), SHIFT_RIGHT(">>"), SHIFT_UNSIGNED_RIGHT(">>>"),
	STRING_CONCAT("+"); 

	/**
	 * Token representing the operator in source code, such as +, !=, or >>.
	 */
	public final String token;
	
	private BinaryOperator(String t) {
		this.token = t;
	}
	
	public String toString() {
		return token;
	}
}